package test

import config.MyFile
import org.apache.commons.io.FileUtils

object test4 extends MyFile{

  def main(args: Array[String]): Unit = {
   val l =  "H:\\南农油茶数据库\\2024_6_12/GWHERAW00000000.RNA.fasta".readFileToString.split(">").tail.map{x=>
      val lines = x.split("\n")
      val gene = lines.head.split("\t").filter(_.startsWith("Gene=")).head.trim.drop(5)
      gene -> lines.tail.mkString
    }.groupBy(_._1).map{x=>
      ">" + x._1 + "\n" + x._2.maxBy(_._2.length)._2
    }.mkString("\n")

    FileUtils.writeStringToFile("H:\\南农油茶数据库\\2024_6_12/Camellia_crapnelliana.cds".toFile,l)
  }
}
